package com.mooltik;

import android.content.Context;
import android.widget.Toast;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.TimeZone;

public class Utils {
    private static final String TAG = "Utils";

    public static String getMoscowTime() {
        SimpleDateFormat moscowTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        moscowTime.setTimeZone(TimeZone.getTimeZone("Europe/Moscow"));
        return moscowTime.format(new Date());
    }

    public static String getNewId(List<HashMap<String, String>> listOfMap) {
        int maxId = 0;
        for (HashMap<String, String> map : listOfMap) {
            String idStr = map.get("id");
            int id = Integer.parseInt(idStr);
            if (id > maxId) {
                maxId = id;
            }
        }
        return String.valueOf(maxId);
    }


    public static void showToast(String s, Context context) {
        Toast.makeText(context, s, Toast.LENGTH_SHORT).show();
    }


    public static boolean isEmptyOrNull(String pass) {
        if (pass == null || pass.equals("")) {
            return true;
        }
        return false;
    }


}
